package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.RechargeRecordBean;
import com.ukao.cashregister.utils.CheckUtils;
import com.ukao.cashregister.utils.MyDateUtils;

import java.util.List;

/**
 * VIP  组员列表
 */

public class RechargeRecordAdapter extends CommonAdapter<RechargeRecordBean.ListBean> {




    public RechargeRecordAdapter(Context context, List<RechargeRecordBean.ListBean> datas) {
        super(context, datas, R.layout.adapter_recharge_record);
    }


    @Override
    public void convert(ViewHolder holder, RechargeRecordBean.ListBean item) {
        TextView    paySceneText=holder.getView(R.id.paySceneText);
        TextView    payMethodText=holder.getView(R.id.payMethodText);
        TextView    amount=holder.getView(R.id.amount);
        TextView    tradeTime=holder.getView(R.id.tradeTime);
        TextView    seq=holder.getView(R.id.seq);
        TextView    giftAmount=holder.getView(R.id.giftAmount);
        TextView    workName=holder.getView(R.id.workName);
        paySceneText.setText(CheckUtils.isEmptyString(item.getPaySceneText()));
        payMethodText.setText(CheckUtils.isEmptyString(item.getPayMethodText())+"支付");
        amount.setText(CheckUtils.isEmptyNumber(item.getAmount())+"元");
        giftAmount.setText(CheckUtils.isEmptyNumber(item.getGiftAmount())+"元");
        tradeTime.setText("充值时间："+ MyDateUtils.formatDataTime(item.getTradeTime()));
        seq.setText("支付流水号："+item.getSeq());
        switch (item.getCreateBy()) {
            case 0:
                workName.setText("操作人：用户");
                break;
            case -1:
                workName.setText("操作人：系统");
                break;
            default:
                workName.setText("操作人："+item.getWorkName());
                break;
        }



    }


}
